
    <div class="layui-hide-xs">
      <div class="fly-panel fly-column">
        <div class="layui-container">
          <ul class="layui-clear">
            <li class="layui-hide-xs ">
              <a href="/">首页</a></li>
            <li>
              <a href="/column/quiz/">提问</a></li>
            <li>
              <a href="/column/share/">分享
                <span class="layui-badge-dot"></span></a>
            </li>
            <li>
              <a href="/column/discuss/">讨论</a></li>
            <li>
              <a href="/column/suggest/">建议</a></li>
            <li>
              <a href="/column/notice/">公告</a></li>
            <li>
              <a href="/column/news/">动态</a></li>
            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block">
              <span class="fly-mid"></span>
            </li>
            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block">
              <a href="/user/post/">我发表的贴</a></li>
            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block">
              <a href="/user/post/#collection">我收藏的贴</a></li>
          </ul>
          <div class="fly-column-right layui-hide-xs">
            <span class="fly-search LAY_search">
              <i class="layui-icon">&#xe615;</i></span>
            <a href="/jie/add/" class="layui-btn">发表新帖</a></div>
          <div class="layui-hide-sm layui-show-xs-block" style="margin-top: -10px; padding-bottom: 10px; text-align: center;">
            <a href="/jie/add/" class="layui-btn">发表新帖</a></div>
        </div>
      </div>
    </div>
    <div class="layui-container">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-md8 content detail">
          <div class="fly-panel detail-box">
            <h1>{$data.title}</h1>
            <div class="fly-detail-info">
              <span class="layui-badge layui-bg-green fly-detail-column">{$data.cate_name}</span>
              <span class="layui-badge" style="background-color:{$data.status?'#5FB878':' #999'};">{$data.status?'已结':'未结'}</span>
              <div class="fly-admin-box" data-id="51065"></div>
              <span class="fly-list-nums">
                <a href="#comment">
                  <i class="iconfont" title="回答">&#xe60c;</i>{$data.reply_num}</a>
                <i class="iconfont" title="人气">&#xe60b;</i>{$data.view_num}</span></div>
            <div class="detail-about">
              <a class="fly-avatar" href="{:url('index/user/show',['user_id'=>$data['user_id']])}">
                <img src="__ROOT__/{$data.face}" alt="肆喜"></a>
              <div class="fly-detail-user">
                <a href="/u/37439472/" class="fly-link">
                  <cite>{$data.nickname}</cite></a>
                <span>{:time_format($data.create_time)}</span></div>
              <div class="detail-hits" id="LAY_jieAdmin" data-id="51065">
                <span style="padding-right: 10px; color: #FF7200">悬赏：{$data.kiss}飞吻</span>
                {if condition="session('user_id')"}
                <span class="layui-btn layui-btn-xs jie-admin collect {$data.collect_id?'layui-btn-danger':''}" data-id="{$data.question_id}" type="collect" data-type="add">{$data.collect_id?'取消收藏':'收藏'}</span>
                {/if}
              </div>
            </div>
            <div class="detail-body layui-text photos">
              
              {if condition="$data.ext_info"}

              <?php $ext_info = json_decode($data['ext_info'],true); ?>
              <table class="layui-table">
                <tbody>
                  <tr>
                    <td>版本：{$ext_info.project} {$ext_info.version}</td>
                    <td>浏览器：{$ext_info.browser}</td>
                  </tr>
                </tbody>
              </table>
              {/if}
              {$data.content}
            </div>
          </div>
          <a name="top"></a>
          <div class="fly-panel detail-box" id="flyReply">
            <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
              <legend>回帖</legend></fieldset>
            <ul class="jieda" id="jieda">
              {volist name="replys" id='item'}
              <li data-id="174092">
                <a name="item-1555312191693"></a>
                <div class="detail-about detail-about-reply">
                  <a class="fly-avatar" href="{:url('index/user/show',['user_id'=>$item['user_id']])}">
                    <img src="__ROOT__/{$item.face}" alt="{$item.nickname}"></a>
                  <div class="fly-detail-user">
                    <a href="/u/17808336/" class="fly-link">
                      <cite>{$item.nickname}</cite></a>
                  </div>
                  <div class="detail-hits">
                    <span>{:time_format($item.create_time)}</span></div>
                    {if condition='$item.status'}
                    <i class="iconfont icon-caina" title="最佳答案"></i>
                    {/if}
                </div>
                <div class="detail-body layui-text jieda-body photos">{$item.content}</div>
                <div class="jieda-reply">
                  <span class="jieda-zan {$item.zan_id?'zanok':''}" data-id="{$item.reply_id}" type="zan">
                    <i class="iconfont icon-zan"></i>
                    <em>{$item.ok_num}</em></span>
                    <a href="#comment">
                  <span type="reply" class="reply" data-nickname="{$item.nickname}" data-url="{:url('index/user/show',['user_id'=>$item['user_id']])}">
                    <i class="iconfont icon-svgmoban53"></i>回复</span>
                    </a>
                    {if condition="session('user_id')==$data['user_id'] && $data['status']=='0'"}
                    <div class="jieda-admin"> <span class="jieda-accept" data-id="{$item.reply_id}" type="accept"> 采纳 </span> </div>
                    
                    {/if}
                </div>

              </li>
              {/volist}
            </ul>
            <style>
              .pagination{
                margin: 20px 0px;
                padding-bottom: 20px;
              }
              .pagination li{
                display: inline-block;
                padding: 5px 10px;
                border: 1px solid #06988B;
                margin-left: 5px;
                font-size: 16px;
              }
              .pagination .active{
                background: #06988B;
                color: #fff;
              }
              .pagination .disabled{
                background: #ccc url() 0 0 no-repeat;
                border: 1px solid #ccc;
              }
            </style>
            <div style="text-align: center">
              {$replys->render()}
            </div>
            <a name="comment"></a>
            <div class="layui-form layui-form-pane">
              <form action="/jie/reply/" method="post">
                <div class="layui-form-item layui-form-text">
                  <div class="layui-input-block">
                    <textarea id="L_content" name="content" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 100px;"></textarea>
                  </div>
                </div>
                <div class="layui-form-item">
                  <input type="hidden" name="question_id" value="{$data.question_id}">
                  <button class="layui-btn" lay-filter="add" lay-submit>提交回复</button></div>
              </form>
            </div>
          </div>
        </div>
        <div class="layui-col-md4">
          {include file="public/hot" /}
          <div class="fly-panel">
            <div class="fly-panel-title">心级赞助商
              <span style="padding: 0 3px;">-</span>
              <a href="/jie/15697/" class="fly-link fly-joinad    ">我要加入</a></div>
            <div class="fly-panel-main">
              <a href="https://e.coding.net/?utm_source=layui" target="_blank" rel="nofollow" class="fly-zanzhu fly-zanzhu-img" time-limit="2020-04-15 0:0:0" style="background: none;">
                <img src="//cdn.layui.com/upload/2019_4/168_1554866647505_95027.png" alt="CODING"></a>
              <a href="https://www.renren.io/layui" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #4BAE4F;" time-limit="2019-09-08 0:0:0">人人开源 - 企业级后台脚手架框架</a>
              <a href="https://www.chanmir.com/server/buy.html" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #192933;" time-limit="2019-04-19 0:0:0">千铭高防云 BGP 服务器 · 14元起</a></div>
          </div>
          <div class="fly-panel">
            <div class="fly-panel-title">官方产品</div>
            <div class="fly-panel-main">
              <a href="http://www.layui.com/admin/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #20222A; background-image: linear-gradient(to right,#20222A,#3E4251);">layuiAdmin - layui 官方后台管理模板</a>
              <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #009688; background-image: linear-gradient(to right,#009688,#5FB878);">LayIM - layui 即时通讯旗舰之作</a></div>
          </div>
          <div class="fly-panel" style="padding: 20px 0; text-align: center;">
            <img src="//cdn.layui.com/upload/2017_8/168_1501894831075_19619.jpg" style="max-width: 100%;" alt="layui">
            <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p></div>
        </div>
      </div>
    </div>

    <script>
  //Demo
  layui.use(['form','jquery','layedit'], function(){
    var form = layui.form;
    var $ = layui.jquery;
    var layedit = layui.layedit;


    layedit.set({
      uploadImage: {
        url: '{:url('index/jie/upload')}' 
        ,type: '' //默认post
      }
    });

    index = layedit.build('L_content',{
        height: 180 //设置编辑器高度
      }); //建立编辑器


    $('.jieda-accept').click(function(event) {
        var reply_id = $(this).attr('data-id');

        $.post("{:url('index/jie/cai')}",{reply_id:reply_id}, function(data, textStatus, xhr) {
            if(data.code==1){
              layer.alert(data.msg, {icon: 6},function(){
               
                 location.reload();
              });
            }else{
              layer.msg(data.msg, function(){});
            }
        });
    });

    $('.collect').click(function(event) {
        var question_id = $(this).attr('data-id');
        var that =$(this);
        $.post("{:url('index/jie/collect')}",{question_id:question_id}, function(data, textStatus, xhr) {
            if(data.code==1){
              if(data.msg=='收藏成功'){
                that.addClass('layui-btn-danger');
                that.html('取消收藏');
              }else{
                that.removeClass('layui-btn-danger');
                that.html('收藏');
              }
            }else{
              layer.msg(data.msg, function(){});
            }
        });

    });
    
    $('.jieda-zan').click(function(event) {

        if($(this).hasClass('zanok')){
          layer.msg('你已经点赞过', function(){});
          return;
        }
        var reply_id = $(this).attr('data-id');
        var that = $(this);
        $.post("{:url('index/jie/zan')}",{reply_id:reply_id}, function(data, textStatus, xhr) {
            if(data.code==1){
              that.addClass('zanok');
              var num = Number(that.find('em').html());
              num++;
              that.find('em').html(num);
            }else{
              layer.msg(data.msg, function(){});
            }
        });

    });
    $('.reply').click(function(event) {
        var nickname = $(this).attr('data-nickname');
        var url = $(this).attr('data-url');
        str = "<a href='"+url+"'>@"+nickname+"</a>&nbsp; &nbsp;";

        layedit.setContent(index,str);
    });
    //监听提交
    form.on('submit(add)', function(data){

      data.field.content = layedit.getContent(index);

      console.log(data.field);
      // layer.msg(JSON.stringify(data.field));

      $.post("{:url('index/jie/reply')}",data.field, function(data, textStatus, xhr) {
          if(data.code==1){
            location.href ="{:url('index/jie/show',['qid'=>$data['question_id']])}"+"#top";
            layer.alert(data.msg, {icon: 6},function(){
               
               location.reload();
            });
          }else{
            $('#code').click();
            layer.msg(data.msg, function(){});
          }
      });

      return false;
    });
  });
  </script>
    
    